package com.uchengwang.ui.cm_ui.cycle.viewHolder;

import android.support.v7.widget.AppCompatCheckBox;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.uchengwang.R;
import com.uchengwang.ui.utils.WidgetUtil;
import com.zhy.autolayout.utils.AutoUtils;

/**
 * Created by U城网 on 2018/1/24.
 * 类似好友布局 获取基本的控件对象
 */

public class BaseViewHolder extends RecyclerView.ViewHolder{
    public View view;
    public ImageView head, imageAtten;
    public TextView name, des, apply_type;
    public LinearLayout apply_ln;
    public Button bt, apply_del;
    public ImageView apply_sex;
    public AppCompatCheckBox apply_checkBox;
    //1粉丝 2关注 3好友
    private int type;//根据type显示或隐藏某些控件

    public BaseViewHolder(View itemView, int type) {
        super(itemView);
        AutoUtils.autoSize(itemView);
        this.type = type;

        view = itemView;
        head =  itemView.findViewById(R.id.apply_image);
        name =  itemView.findViewById(R.id.apply_name);
        apply_type =  itemView.findViewById(R.id.apply_type);
        des =  itemView.findViewById(R.id.apply_school);

        apply_checkBox =  itemView.findViewById(R.id.apply_checkBox);
        apply_del =  itemView.findViewById(R.id.apply_del);

        apply_ln =  itemView.findViewById(R.id.apply_ln);

        imageAtten =  itemView.findViewById(R.id.apply_authen_logo);
        bt =  itemView.findViewById(R.id.apply_atten);

        apply_sex =  itemView.findViewById(R.id.apply_sex);
        switch (type){
            case 0:
            case 1://粉丝
                bt.setVisibility(View.VISIBLE);
                break;
            case 2://关注
            case 9://查看群成员
                break;
            case 3://好友
                bt.setVisibility(View.VISIBLE);
                WidgetUtil.getUtil().setChatWidget(bt);
                break;
            case 4://选择好友建群
            case 5://邀请好友加群
            case 6://推荐给好友
            case 7://移除好友
                apply_ln.setVisibility(View.VISIBLE);
                break;
            case 8://管理权转让
                bt.setVisibility(View.VISIBLE);
//                bt.setBackground(null);
                bt.setText("转让");

                break;
        }
    }


}
